package returnDataStruct;

import Service.Implement.userServiceImplement;
import Service.userService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import pojo.room;

import java.util.Date;

public class roomData {
    private userService userService=((ApplicationContext)new ClassPathXmlApplicationContext("bean1.xml")).getBean("userServiceImplement",userService.class);
    private Long room_id;
    private String room_location;//stadium
    private String room_playground;
    private roomDate room_date;
    private int lack_person;
    private int room_state;
    private String room_sports;
    private double room_price;
    private int room_all_person;
    private int room_now_person;
    private Long room_host_id;
    private String room_host_Id;


    @Override
    public String toString() {
        return "roomData{" +
                "userService=" + userService +
                ", room_id=" + room_id +
                ", room_location='" + room_location + '\'' +
                ", room_playground='" + room_playground + '\'' +
                ", room_date=" + room_date +
                ", lack_person=" + lack_person +
                ", room_state=" + room_state +
                ", room_sports='" + room_sports + '\'' +
                ", room_price=" + room_price +
                ", room_all_person=" + room_all_person +
                ", room_now_person=" + room_now_person +
                ", room_host_id=" + room_host_id +
                ", room_host_Id='" + room_host_Id + '\'' +
                '}';
    }

    public int getRoom_state() {
        return room_state;
    }

    public double getRoom_price() {
        return room_price;
    }

    public void setRoom_price(double room_price) {
        this.room_price = room_price;
    }

    public int getRoom_all_person() {
        return room_all_person;
    }

    public void setRoom_all_person(int room_all_person) {
        this.room_all_person = room_all_person;
    }

    public int getRoom_now_person() {
        return room_now_person;
    }

    public void setRoom_now_person(int room_now_person) {
        this.room_now_person = room_now_person;
    }

    public Long getRoom_host_id() {
        return room_host_id;
    }

    public void setRoom_host_id(Long room_host_id) {
        this.room_host_id = room_host_id;
    }

    public void setRoom_state(int room_state) {
        this.room_state = room_state;
    }

    public String getRoom_host_Id() {
        return room_host_Id;
    }

    public void setRoom_host_Id(String room_host_Id) {
        this.room_host_Id = room_host_Id;
    }

    public roomData(room r){
        setRoom_id(r.getRoom_id());
        setRoom_location(r.getStadium());
        setRoom_playground(r.getPlayground());
        setRoom_date(new roomDate(r));
        setLack_person(r.getCapacity()-r.getCurrent_number());
        setRoom_state(r.getRoomstate());
        setRoom_sports(r.getSports_id());
        setRoom_price(r.getMoney());
        setRoom_all_person(r.getCapacity());
        setRoom_now_person(r.getCurrent_number());
        setRoom_host_id(r.getHost_id());
        setRoom_host_Id(userService.queryUserByid(r.getHost_id()).getStudent_id());
    }

    public Long getRoom_id() {
        return room_id;
    }

    public void setRoom_id(Long room_id) {
        this.room_id = room_id;
    }

    public String getRoom_location() {
        return room_location;
    }

    public void setRoom_location(String room_location) {
        this.room_location = room_location;
    }

    public String getRoom_playground() {
        return room_playground;
    }

    public void setRoom_playground(String room_playground) {
        this.room_playground = room_playground;
    }

    public roomDate getRoom_date() {
        return room_date;
    }

    public void setRoom_date(roomDate room_date) {
        this.room_date = room_date;
    }

    public int getLack_person() {
        return lack_person;
    }

    public void setLack_person(int lack_person) {
        this.lack_person = lack_person;
    }

    public String getRoom_sports() {
        return room_sports;
    }

    public void setRoom_sports(String room_sports) {
        this.room_sports = room_sports;
    }
}

